//////////////////////////////////////////////////////////////////////////////////
//	Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#ifndef __SCHED_CONTROL_YG_H__
#define __SCHED_CONTROL_YG_H__

#include "def.h"

class CSchedulerCtrl: public wxPanel
{
public:
								CSchedulerCtrl(wxWindow* parent, wxWindowID winid, std::vector<bool>&	arrSched);
	virtual						~CSchedulerCtrl(void);


	virtual bool				Enable (bool enable);
	void						SetEnableColor(wxColor color) { m_cEnable=color; }

protected:
	void						OnSize(wxSizeEvent& event);
	void						OnPaint(wxPaintEvent& event);
	void						OnClick(wxMouseEvent& event);
	void						OnMove(wxMouseEvent& event);

private:
	void						DrawScheduler( class wxBufferedPaintDC& dc, const wxRect& rectSchedArea );
	void						DrawGrid( class wxBufferedPaintDC& dc, const wxRect& rectSchedArea );
	void						DrawLabels( class wxBufferedPaintDC& dc);
	void						DrawTimeLine( class wxBufferedPaintDC& dc);
	void						DrawBlockLabel(class wxBufferedPaintDC& dc, size_t i, size_t j);
	void						DrawLegend( class wxBufferedPaintDC& dc );

	bool						IsMouseInside(int xMouse,int yMouse, int x, int y);


private:
	std::vector<bool>&			m_arrSched;
	bool						m_bClick;
	int							m_x;
	int							m_y;
	wxColor						m_cEnable;
	wxColor						m_cON;
	wxColor						m_cOFF;
	size_t						m_stLastIDX;
};

#endif //__SCHED_CONTROL_YG_H__